<?php

namespace app\index\model;

use think\Model;
use traits\model\SoftDelete;

class Test extends Model
{
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';



    public static function showtest()
    {
        $list = Test::order('id desc')->paginate(5);
        return $list;
    }


//    public function getRefreshtimeTextAttr($value, $data)
    public function getCreatetimeAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['refreshtime']) ? $data['refreshtime'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }
}
